home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
returnto.zip
/
SETRETRN.BAT
< prev
Wrap
DOS Batch File
|
1993-04-06
|
3KB
|
62 lines
@echo off
rem SETRETRN
rem -------------------------------------------------- ==Bruce M. Bowman == ---
rem runprogr.BAT, SETRETRN.BAT, and DORETURN.BAT -- for running a program from
rem any starting drive:\directory and returning to that drive:\directory;
rem it is assumed that the program run is one that must be run from its own
rem directory or is not in a PATH'd directory
rem
rem [These batch files were derived from item in PC Magazine, June 26, 1990
rem (Vol. 9, No. 12). RETURNTO.ZIP--RUNPROGR.BAT, SETRETRN.BAT, DORETURN.BAT]
rem ---------------------------------------------------------------------------
rem SETRETRN - 1) This batch file creates a batch file ZZZZZZZ1.BAT that has
rem one line, viz.: prompt cd $p
rem 2) It then executes that batch file as at the end of this file
rem to produce a 4-line batch file ZZZZZZZ2.BAT that will be
rem as below if the starting drive and directory are, for
rem example, C: and \UTILS:
rem (line 1, blank)
rem C: xprompt cd $p (line 2)
rem (line 3, blank)
rem cd C:\UTILS (line 4)
rem
rem 3) The ZZZZZZZ2.BAT file will be used by DORETURN.BAT to reset
rem the starting drive and directory after completion of an
rem applications batch execution in which the drive and
rem directory are changed.
rem
rem EXAMPLE APPLICATIONS BATCH FILE (runprogr.BAT)
rem
rem @ECHO OFF
rem rem EXAMPLE APPLICATIONS BATCH FILE (runprogr.BAT)
rem rem
rem rem Run QEDIT from C:\UTILS *and return to the starting
rem rem drive and directory*.
rem rem
rem rem If DOS version is earlier than 3.3, delete @ and
rem rem substitute COMMAND /C for CALL in this batch file.
rem rem The batch files SETRETRN.BAT and DORETURN.BAT must
rem rem be in a PATH'd directory. *This* file (runprogr.BAT)
rem rem must also be in a PATH'd directory.
rem rem
rem rem "runprogr" can be a name of your choosing and
rem rem "MYPROGRM" is the name of the applications program
rem rem to run; e.g., "runprogr.BAT" = "EDIT.BAT" and
rem rem "MYPROGRM" = "QEDIT".
rem rem
rem CALL SETRETRN
rem C:
rem CD \UTILS
rem QEDIT %1
rem CALL DORETURN
rem
rem ---------------------------------------------------------------------------
rem If ZZZZZZZ1.BAT and ZZZZZZZ2.BAT can be written to and executed from *any*
rem convenient drive and directory. Here, they are in the C:\ root directory.
rem The batch files SETRETRN.BAT, DORETURN.BAT, and runprogr.BAT must be in
rem a PATH'd directory.
echo prompt cd $p>c:\zzzzzzz1.bat
prompt $n: x
command /c c:\zzzzzzz1.bat >c:\zzzzzzz2.bat
prompt $p$g